package jsu.xnm.evelyn.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class FileUtil {

    //定义一个文件上传路径
    public static final String UPLOAD_FILE_DIRECTORY = "static/img/upload/";

    //给文件名加前缀，防止覆盖
    public static String makeFilePrefix(String fileName){
        String uuid = UUID.randomUUID().toString();
        return uuid+"-"+fileName;
    }

    //创建多级目录
    public static String makeFileDir(){
        Date date = new Date();
        String format = new SimpleDateFormat("yyyy/MM/dd").format(date);
        return format;
    }
}